//
//  UIBarButtonItem+Extension.swift
//  WBDemo
//
//  Created by Jin on 17/04/2018.
//  Copyright © 2018 com.baidu.123. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    convenience init(imageName:String,target:AnyObject,action:Selector){
        
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), for: UIControlState.normal)
        btn.setImage(UIImage(named: imageName + "_highlighted"), for: UIControlState.highlighted)
        btn.addTarget(target, action: action, for: UIControlEvents.touchUpInside)
        btn.sizeToFit()
        self.init(customView: btn)
        
    }
}
